namespace DotNetNuke.Services.Scheduling.DNNScheduling
{
    using DotNetNuke.Framework;
    using System;
    using System.Data;

    public abstract class DataProvider
    {
        private static DataProvider objProvider = null;
        private const string ProviderAssemblyName = "DotNetNuke.DNNScheduler";
        private const string ProviderNamespace = "DotNetNuke.Services.Scheduling.DNNScheduling";
        private const string ProviderType = "data";

        static DataProvider()
        {
            CreateProvider();
        }

        public abstract int AddSchedule(string TypeFullName, int TimeLapse, string TimeLapseMeasurement, int RetryTimeLapse, string RetryTimeLapseMeasurement, int RetainHistoryNum, string AttachToEvent, bool CatchUpEnabled, bool Enabled, string ObjectDependencies, string Servers);
        public abstract int AddScheduleHistory(int ScheduleID, DateTime StartDate, string Server);
        private static void CreateProvider()
        {
            objProvider = (DataProvider) Reflection.CreateObject("data", "DotNetNuke.Services.Scheduling.DNNScheduling", "DotNetNuke.DNNScheduler");
        }

        public abstract void DeleteSchedule(int ScheduleID);
        public abstract IDataReader GetNextScheduledTask(string Server);
        public abstract IDataReader GetSchedule();
        public abstract IDataReader GetSchedule(int ScheduleID);
        public abstract IDataReader GetSchedule(string Server);
        public abstract IDataReader GetSchedule(string TypeFullName, string Server);
        public abstract IDataReader GetScheduleByEvent(string EventName, string Server);
        public abstract IDataReader GetScheduleHistory(int ScheduleID);
        public abstract IDataReader GetScheduleItemSettings(int ScheduleID);
        public static DataProvider Instance()
        {
            return objProvider;
        }

        public abstract void PurgeScheduleHistory();
        public abstract void UpdateSchedule(int ScheduleID, string TypeFullName, int TimeLapse, string TimeLapseMeasurement, int RetryTimeLapse, string RetryTimeLapseMeasurement, int RetainHistoryNum, string AttachToEvent, bool CatchUpEnabled, bool Enabled, string ObjectDependencies, string Servers);
        public abstract void UpdateScheduleHistory(int ScheduleHistoryID, DateTime EndDate, bool Succeeded, string LogNotes, DateTime NextStart);
    }
}

